<?php

use console\db\Migration;

/**
 * 创建排查相关信息表
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class m190102_100005_t_worker extends Migration {

    /**
     * 职工信息表
     * @table `staff`
     */
    public function buildTableStaff() {
        return [
            'comment' => '职工信息表',
            'columns' => [
                'id' => $this->primaryKey()->comment('员工ID'),
                'user_id' => $this->integer(11)->unsigned()->notNull()->defaultValue(0)->comment('用户ID'),
                'realname' => $this->string(50)->notNull()->comment('姓名'),
                'mobile' => $this->char(32)->unique()->comment('手机号'),
                'mobile_hash' => $this->char(255)->comment('加密手机号'),
                'company_id' => $this->integer(11)->unsigned()->notNull()->defaultValue(0)->comment('隶属单位ID'),
                'status' => $this->tinyint(1)->notNull()->defaultValue(10)->comment('状态'),
                'created_at' => $this->unixTimestamp()->comment('注册时间'),
                'updated_at' => $this->unixTimestamp()->comment('更新时间'),
                'deleted_at' => $this->unixTimestamp()->comment('注销时间'),
            ]
        ];
    }

}
